package com.znf4.controller.trade;

import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import com.znf4.controller.common.BaseController;
import com.znf4.service.CommonServiceManager;

/**
 * 交易管理
 */
@Controller
@RequestMapping("/merchant/trade")
public class TradeController extends BaseController {
	
	private static final Log LOG = LogFactory.getLog(TradeController.class);

	@Autowired
	private CommonServiceManager commonServiceManager ;
	
    static int num = 0 ;
    static int faildnum = 0 ;
	
	/**
	 * 函数功能说明 ：积分 商品交易
	 * @参数： @return
	 * @return String
	 * @throws
	 */
	@RequestMapping("/free")
	@ResponseBody
	public String trade(String id , String type ) {
		
		if(commonServiceManager.tradeJifenGood(id, type)){
			num ++ ;
			LOG.info("抢到了...." + num );
			return "true" ;
		}
		faildnum ++ ;
		LOG.info("没抢到...." + faildnum);
		return "false";
	}
	
	
	
	
	
	
	
	
}
